<template>
  <li class="foodsli" @click="FoodContent(item.item_id)">
    <div v-if="index == 0" class="imgsuo" :style="{width:'100%',height:'auto'}">
      <img :src="item.card_image" />
    </div>

    <div
      v-else
      class="imgsuo"
      :style="{ backgroundImage: 'url(' + item.card_image + ')' }"
    >
      <!-- <img :src="item.card_image" /> -->
    </div>

    <div class="two" v-if="item.title">
      <h4>{{ item.title }}</h4>
      <p>{{ item.description }}</p>
    </div>

    <div class="foodslibottom" v-if="item.title">
      <div class="sanleft">
        <span>
          <img src="../assets/image/ic_analyse_default.png" alt="" />
        </span>
        <span>{{ item.publisher }}</span>
      </div>

      <div class="sanright">
        <span><img src="../assets/image/ic_home_agree.png" alt="" /></span>
        <span>{{ item.like_ct }}</span>
      </div>
    </div>
  </li>
</template>

<script>
export default {
  props: ["item", "index"],
  methods: {
    FoodContent: function (id) {
      this.$router.push({
        path: "/FoodDetails",
        query: {
          id,
        },
      });
    },
  },
};
</script>

<style lang="less" scoped>
.foodsli {
  border-radius: 3px;
  box-shadow: 0px 0px 2px #888888;
  position: relative;
  flex-basis: 50%;
  margin: 10px 5px;

  .imgsuo {
    width: 100%;
    height: 170px;
    background-size: 100%;

  }

  .two {
    width: 100%;
    background: white;
    padding: 2px 3px;
    h4 {
      padding-top: 10px;
      padding-bottom: 3px;
      font-size: 15px;
    }
    p {
      font-size: 12px;
      height: auto;
      overflow: hidden;
      color: rgb(179, 165, 165);
      padding-bottom: 10px;
    border-bottom: 1px solid rgba(204, 198, 198, 0.452);
    zoom:0.9;

    }
  }

  .foodslibottom {
    width: 100%;
    // border-top: 1px solid rgba(204, 198, 198, 0.452);
    padding: 5px 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .sanleft {
      display: flex;
      align-items: center;
      // width: 50%;
      flex: 1;
      span {
        &:nth-child(1) {
          width: 20%;
          // margin: 0 5px;
  margin-right: 2px;
          img {
            border-radius: 50%;
            width: 100%;
          }
        }
        &:nth-child(2) {
          font-size: 12px;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      }
    }
    .sanright {
      width: 30%;
      display: flex;
      align-items: center;
      span {
        &:nth-child(1) {
          width: 50%;
          img {
            // border-radius: 50%;
            width: 70%;
            vertical-align: middle;

          }
        }
        &:nth-child(2) {
          font-size: 12px;
        }
      }
    }
  }
}
</style>